package com.baizhi.cmfz.service.impl;

import com.baizhi.cmfz.dao.LogDao;
import com.baizhi.cmfz.entiy.Log;
import com.baizhi.cmfz.service.LogService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

@Service
public class LogServiceImpl implements LogService {


    @Autowired
    private LogDao dao;

    private Logger logger = LoggerFactory.getLogger(LogServiceImpl.class);


    @Override
    public Map selectAll(int page, int rows, String username) {
        Map map = new HashMap();
       /* //若用户名不等于null和空串
        if(username!=null && !"".equals(username)){
            username="%"+username+"%";//在java代码中拼接好，可以屏蔽数据库的差异
        }else{
            username=null;
        }
        int total = dao.getTotal(username);
        map.put("total", total);
        int start=(page-1)*rows;
        int pageSize=rows;
        List<Log> list = dao.selectAllLog(start,pageSize,username);
        map.put("rows", list);
        logger.debug(""+map.get("rows"));*/
        return map;


    }
}
